﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        getItemList()
        if (!!keyValue) {
            $.ajax({
                url: "/SiteManage/Supplier/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                }
            });
        }
    });
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/SiteManage/Supplier/SubmitForm?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
    function getItemList() {
        $.ajax({
            url: "/SiteManage/Site/GetItemListJson",
            dataType: "json",
            async: false,
            success: function (data) {
                initControl(data)
            }, error: function (XMLHttpRequest, textStatus, errorThrown) {
                console.log(XMLHttpRequest);
                console.log(textStatus);
                console.log(errorThrown);
            }
        });
    }
    function initControl(ItemList) {
        var City = ItemList.City;
        for (var i = 0; i < City.length; i++) {
            $("#city_id").append("<option value='" + City[i].F_ItemCode + "'>" + City[i].F_ItemName + "</option>");
        }
        var SiteState = ItemList.SiteState;
        for (var i = 0; i < SiteState.length; i++) {
            $("#state").append("<option value='" + SiteState[i].F_ItemCode + "'>" + SiteState[i].F_ItemName + "</option>");
        }
        $("#state").bindSelect()//场地状态
        $("#city_id").bindSelect()//上线状态
        $('#city_id').select2({
            placeholder:'==请选择城市=='
        });
    }
</script>

<form id="form1">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">供应商名称<span style="color:red">*</span></th>
                <td class="formValue">
                    <input id="name" name="name" type="text" class="form-control required" placeholder="请录入供应商名称" />
                </td>
                <th class="formTitle">公司规模</th>
                <td class="formValue">
                    <input id="company_size" name="company_size" type="text" class="form-control" placeholder="请录入公司规模" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">联系人<span style="color:red">*</span></th>
                <td class="formValue">
                    <input id="the_contact" name="the_contact" type="text" class="form-control required" placeholder="请录入联系人" />
                </td>
                <th class="formTitle">联系手机<span style="color:red">*</span></th>
                <td class="formValue">
                    <input id="phone" name="phone" type="text" class="form-control required" placeholder="请录入联系手机" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">城市<span style="color:red">*</span></th>
                <td class="formValue">
                    <select id="city_id" name="city_id" class="form-control required">
                        <option value="">==请录入城市==</option>
                    </select>
                </td>
                <th class="formTitle">联系电话</th>
                <td class="formValue">
                    <input id="mobile" name="mobile" type="text" class="form-control" placeholder="请录入联系电话" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">公司负责人</th>
                <td class="formValue">
                    <input id="company_owner" name="company_owner" type="text" class="form-control" placeholder="请录入公司负责人" />
                </td>
                <th class="formTitle">行业领域</th>
                <td class="formValue">
                    <input id="industry_field" name="industry_field" type="text" class="form-control" placeholder="请录入行业领域" />
                </td>
            </tr>
            @*<tr>
                <th class="formTitle">服务类型</th>
                <td class="formValue">
                    <input id="service_type" name="service_type" type="text" class="form-control" placeholder="请录入服务类型" />
                </td>
            </tr>*@
            <tr>
                <th class="formTitle">业务范围</th>
                <td class="formValue">
                    <input id="business_scope" name="business_scope" type="text" class="form-control" placeholder="请录入业务范围" />
                </td>
                <th class="formTitle">业务性质</th>
                <td class="formValue">
                    <input id="business_nature" name="business_nature" type="text" class="form-control" placeholder="请录入业务性质" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">公司简介</th>
                <td class="formValue" colspan="3">
                    <textarea id="company_profile" style="height:70px" name="company_profile" type="text" class="form-control" placeholder="请录入公司简介"></textarea>
                </td>
            </tr>
            <tr>
                <th class="formTitle">资质</th>
                <td class="formValue">
                    <input id="aptitude" name="aptitude" type="text" class="form-control" placeholder="请录入" />
                </td>
                <th class="formTitle">状态<span style="color:red">*</span></th>
                <td class="formValue">
                    <select id="state" name="state" class="form-control required">
                    </select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">对应客服</th>
                <td class="formValue">
                    <input id="customer_service" name="customer_service" type="text" class="form-control" placeholder="请录入对应客服" />
                </td>
                <th class="formTitle">对应销售人员</th>
                <td class="formValue">
                    <input id="sales" name="sales" type="text" class="form-control" placeholder="请录入对应销售人员" />
                </td>
            </tr>

            <tr>
                <th class="formTitle">来源</th>
                <td class="formValue">
                    <input id="source" name="source" type="text" class="form-control" placeholder="请录入来源" />
                </td>
                <th class="formTitle"></th>
                <td class="formValue"></td>
            </tr>
        </table>
    </div>
</form>


